home *** CD-ROM | disk | FTP | other *** search
/ CyberMycha 2008 January / Cybermycha 1_2008.iso / drappa / setup.exe / {app} / scripts / loadstream.lcc < prev    next >
Encoding:
Text File  |  2005-08-18  |  1.6 KB  |  42 lines

  1. /*
  2.  *    LaCube NullObject Options Script
  3.  *
  4.  *    name: LoadStream
  5.  *    param: stream (wave, ogg) filename to load
  6.  *    description: loads a stream file and put it into nullobject's option
  7.  *    code: Lettique
  8.  *    last modification: May 1st, 2005, 23:44
  9.  *
  10.  *    comment: pity that Angel doesnt know what void** ppPtr = &pPtr; means...
  11.  *
  12.  *    parameters:
  13.  *        - pFileName [in] - a file name to load, shall be in the same directory as the scene is
  14.  *        - fMin [in] - minimum distance (where attenuation starts)
  15.  *        - fMax [in] - maximum distance (where attenuation ends - the sound is no longer audible)
  16.  *        - Flags [in] - flags, one of LACUBE::MusiqueStream, adnotice that Angel doesnt have enums yet, so
  17.  *                the value shall be passed ie for stream_loop, 32 shall be passed:
  18.  *            stream_ctrl3d            = 1,    - set by default, every sound stream is then 3D sound
  19.  *            stream_ctrlfrequency        = 8,
  20.  *            stream_loop            = 32,
  21.  *        - Start [in] - shall the sound start after running the scene it's attached to (1 - yes, 0 - no)
  22.  *
  23.  */
  24.  
  25. void LoadStream( bstr pFileName, float fMin, float fMax, uint Flags, uint Start )
  26. {
  27.     CNullInterface* pNull = GetNullParent();
  28.     CLaCubeD3DInterface* pLaCube = GetLaCubeD3DInterface();
  29.     MusiqueInterface* pMusique = pLaCube->GetMusiqueInterface();
  30.  
  31.     MusiqueStream* pStream = 0;
  32.     pMusique->LoadStream( pFileName, pStream, Flags + 1 );        // 1 - MusiqueStream::stream_ctrl3d
  33.  
  34.     if ( pStream != 0 )
  35.     {
  36.         CNullOptionsInterface* pOptions = pNull->GetNullOptions();
  37.         pOptions->SetOption( 2, pStream, Start );            // 2 - option_musique_stream
  38.  
  39.         pStream->SetMinDistance( fMin );
  40.         pStream->SetMaxDistance( fMax );
  41.     }
  42. }